# Contributor: Grigory Kirillov <txgk@bk.ru>
# Maintainer:
pkgname=flintqs
pkgver=1.0
pkgrel=1
pkgdesc="Highly optimized multi-polynomial quadratic sieve for integer factorization"
url="https://github.com/sagemath/FlintQS"
arch="all"
license="GPL-2.0-or-later"
makedepends="autoconf automake gmp-dev libtool"
source="https://github.com/sagemath/FlintQS/archive/v$pkgver/flintqs-v$pkgver.tar.gz"
builddir="$srcdir/FlintQS-$pkgver"

prepare() {
	default_prepare
	touch ChangeLog
	autoreconf -fi
}

build() {
	export CFLAGS="${CFLAGS/-Os/-O3}" # gotta go fast

	./configure \
		--target="$CTARGET" \
		--build="$CBUILD" \
		--host="$CHOST" \
		--prefix=/usr
	make
}

check() {
	echo 1000000000000000000000000000000000000000 | ./src/QuadraticSieve
}

package() {
	install -Dm755 src/QuadraticSieve "$pkgdir"/usr/bin/QuadraticSieve
}

sha512sums="
5be6422d1d666ffddf4fd29db761c4c5b6c196c3a4b2b62071e6ed0df9ef8645cbae4da6d01ca9bc1dfa1ffc680b7b9683f0f4291767af986f9fef6c0a37b793  flintqs-v1.0.tar.gz
"
